<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>splitrig</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="spectrum.html" title="spectrum" />
    <link rel="next" href="sprintf.html" title="sprintf" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">splitrig</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="spectrum.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="sprintf.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="splitrig"></a>
      <div class="titlepage"></div>
      <a id="Indexsplitrig" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">splitrig</span>
        </h2>
        <p>splitrig — 
      Split a trigger signal
    </p>
      </div>
      <div class="refsect1">
        <a id="idp151181440"></a>
        <h2>Description</h2>
        <p>
      <span class="emphasis"><em>splitrig</em></span> splits a trigger signal (i.e. a timed sequence of control-rate impulses) into several channels following a structure designed by the user.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp151223200"></a>
        <h2>Syntax</h2>
        <pre class="synopsis"><span class="command"><strong>splitrig</strong></span> ktrig, kndx, imaxtics, ifn, kout1 [,kout2,...,koutN]</pre>
      </div>
      <div class="refsect1">
        <a id="idp151225280"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>imaxtics</em></span> - number of tics belonging to largest pattern
    </p>
        <p>
      <span class="emphasis"><em>ifn</em></span> - number of table containing channel-data structuring
    </p>
      </div>
      <div class="refsect1">
        <a id="idp151227712"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>asig</em></span> - incoming (input) signal
    </p>
        <p>
      <span class="emphasis"><em>ktrig</em></span> - trigger signal
    </p>
        <p>
      The <span class="emphasis"><em>splitrig</em></span> opcode splits a trigger signal into several output channels according to one or more patterns provided by the user. Normally the regular timed trigger signal generated by metro opcode is used to be transformed into rhythmic pattern that can trig several independent melodies or percussion riffs. But you can also start from non-isocronous trigger signals. This allows to use some "interpretative" and less "mechanic" groove variations.

Patterns are looped and each numtics_of_pattern_N the cycle is repeated. 
    </p>
        <p>
The scheme of patterns is defined by the user and is stored into <span class="emphasis"><em>ifn</em></span> table according to the following format:
    </p>
        <p>
            </p>
        <pre class="programlisting">
gi1  ftgen 1,0,1024,  -2 \  ; table is generated with GEN02 in this case
\                           ;
numtics_of_pattern_1, \ ;pattern 1
   tic1_out1, tic1_out2, ... , tic1_outN,\
   tic2_out1, tic2_out2, ... , tic2_outN,\
   tic3_out1, tic3_out2, ... , tic3_outN,\
   .....
   ticN_out1, ticN_out2, ... , ticN_outN,\
\
numtics_of_pattern_2, \ ;pattern 2
   tic1_out1, tic1_out2, ... , tic1_outN,\
   tic2_out1, tic2_out2, ... , tic2_outN,\
   tic3_out1, tic3_out2, ... , tic3_outN,\
   .....
   ticN_out1, ticN_out2, ... , ticN_outN,\
   .....
\
numtics_of_pattern_N,\ ;pattern N
   tic1_out1, tic1_out2, ... , tic1_outN,\
   tic2_out1, tic2_out2, ... , tic2_outN,\
   tic3_out1, tic3_out2, ... , tic3_outN,\
   .....
   ticN_out1, ticN_out2, ... , ticN_outN,\
        </pre>
        <p>
   </p>
        <p>
This scheme can contain more than one pattern, each one with a different number of rows. Each pattern is preceded by a a special row containing a single <span class="emphasis"><em>numtics_of_pattern_N</em></span> field; this field expresses the number of tics that makes up the corresponding pattern. Each pattern's row makes up a tic.  Each pattern's column corresponds to a channel, and each field of a row is a number that makes up the value outputted by the corresponding <span class="emphasis"><em>koutXX</em></span> channel (if number is a zero, corresponding output channel will not trigger anything in that particular arguments). Obviously, all rows must contain the same number of fields that must be equal to the number of <span class="emphasis"><em>koutXX</em></span> channel. All patterns must contain the same number of rows, this number must be equal to the largest pattern and is defined by <span class="emphasis"><em>imaxtics</em></span> variable. Even if a pattern has less tics than the largest pattern, it must be made up of the same number of rows, in this case, some of these rows, at the end of the pattern itself, will not be used (and can be set to any value, because it doesn't matter).
   </p>
        <p>
The <span class="emphasis"><em>kndx</em></span> variable chooses the number of the pattern to be played, zero indicating the first pattern. Each time the integer part of <span class="emphasis"><em>kndx</em></span> changes, tic counter is reset to zero.
    </p>
        <p>
    Patterns are looped and each <span class="emphasis"><em>numtics_of_pattern_N</em></span> the cycle is repeated.
    </p>
        <p>examples
      4 - calculate average value of asig in the time interval
    </p>
        <p>
      This opcode can be useful in several situations, for example to implement a vu-meter 
    </p>
      </div>
      <div class="refsect1">
        <a id="idp151241024"></a>
        <h2>Credits</h2>
        <p>Written by Gabriel Maldonado.</p>
        <p>New in Csound 5 (Previously available only on CsoundAV)</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="spectrum.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="sprintf.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">spectrum </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> sprintf</td>
        </tr>
      </table>
    </div>
  </body>
</html>
